home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.0 / stk-3 / blt-for-STk-3.0 / blt-1.9 / configure.in < prev    next >
Encoding:
Text File  |  1995-12-19  |  12.0 KB  |  443 lines

  1. AC_INIT(src/bltInit.c)
  2.  
  3. # -----------------------------------------------------------------------
  4. #
  5. #     C compiler and debugging flags
  6. #
  7. # -----------------------------------------------------------------------
  8. AC_WITH(gcc, CC=gcc)
  9. AC_WITH(acc, CC=acc)
  10. AC_WITH(lcc, CC=lcc)
  11. AC_WITH(cc, CC=cc)
  12. if test -z "$CC" ; then 
  13.     CC=cc
  14. fi
  15. compiler=`basename $CC`
  16. if test "$compiler" = "gcc" ; then
  17.     CC="$CC -fwritable-strings -Wall"
  18. fi
  19. AC_SUBST(CC)
  20.  
  21. CDEBUGFLAGS="-O"
  22. AC_WITH(debug, CDEBUGFLAGS=-g)
  23. AC_SUBST(CDEBUGFLAGS)
  24.  
  25. # -----------------------------------------------------------------------
  26. #
  27. #     Set prefix variable if one wasn't provided
  28. #
  29. # -----------------------------------------------------------------------
  30. if test -z "$prefix" ; then
  31.     prefix=/usr/local/blt
  32. fi
  33. AC_SUBST(prefix)
  34.  
  35. # -----------------------------------------------------------------------
  36. #
  37. #     Set PWD variable if vendor's /bin/sh doesn't
  38. #
  39. # -----------------------------------------------------------------------
  40. if test -z "$PWD" ; then
  41.     PWD=`pwd`
  42. fi
  43.  
  44. # -----------------------------------------------------------------------
  45. #
  46. #     Check for existence of ranlib and install programs
  47. #
  48. # -----------------------------------------------------------------------
  49. AC_PROG_INSTALL
  50. AC_PROG_RANLIB
  51. AC_PROG_CPP
  52.  
  53. AC_CONFIG_HEADER(src/bltConfig.h)
  54.  
  55. # -----------------------------------------------------------------------
  56. #
  57. #     Check for header files
  58. #
  59. # -----------------------------------------------------------------------
  60. AC_STDC_HEADERS
  61. AC_HAVE_HEADERS(stdlib.h string.h float.h malloc.h)
  62. AC_HAVE_HEADERS(errno.h unistd.h memory.h limits.h sys/time.h sys/wait.h)
  63. AC_TIME_WITH_SYS_TIME
  64.  
  65. # -----------------------------------------------------------------------
  66. #     Check for strerror, strdup, strcasecmp.
  67. # -----------------------------------------------------------------------
  68. AC_HAVE_FUNCS(strerror strdup strcasecmp)
  69. AC_SIZE_T
  70.  
  71. LOSSAGE=""
  72. #--------------------------------------------------------------------
  73. #    The check below checks whether <sys/wait.h> defines the type
  74. #    "union wait" correctly.  It's needed because of weirdness in
  75. #    HP-UX where "union wait" is defined in both the BSD and SYS-V
  76. #    environments.  Checking the usability of WIFEXITED seems to do
  77. #    the trick.
  78. #--------------------------------------------------------------------
  79.  
  80. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  81. #include <sys/wait.h>], [
  82. union wait x;
  83. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  84.              * uses an int. */
  85. ], , [ LOSSAGE="$LOSSAGE -DNO_UNION_WAIT" ])
  86.  
  87. # -----------------------------------------------------------------------
  88. #     Check if postscript prolog can be inlined.
  89. # -----------------------------------------------------------------------
  90. echo "checking if postscript prolog can be inlined"
  91. AC_TEST_PROGRAM([
  92. #include "$PWD/src/bltGrPS.h"
  93. int main() { exit(0); }
  94. ],, [ LOSSAGE="$LOSSAGE -DNO_INLINE_PROLOG" ])
  95.  
  96. AC_SUBST(LOSSAGE)
  97.     
  98. # -----------------------------------------------------------------------
  99. #     Run xmkmf to check for location of X libraries and includes.
  100. #    Fill in some default values if we still can't find anything.
  101. # -----------------------------------------------------------------------
  102. AC_FIND_X
  103.  
  104. XINCDIR="$x_includes"
  105. if test -z "$XINCDIR" ; then
  106.     AC_TEST_CPP([#include <X11/Intrinsic.h>], [ XINCDIR="default" ], [
  107.     places="/usr/X11/include \
  108.     /usr/X386/include \
  109.     /usr/X11R5/include \
  110.     /usr/local/X11R5/include \
  111.     /usr/include/X11R5 \
  112.     /usr/openwin/include \
  113.     /usr/local/X11R4/include \
  114.     /usr/include/X11R4 \
  115.     /usr/local/include \
  116.     /usr/unsupported/include \
  117.     /usr/include"
  118.     for dir in $places; do
  119.     if test -r $dir/X11/Intrinsic.h; then
  120.         XINCDIR=$dir
  121.         break
  122.     fi
  123.     done
  124.     if test -z "$XINCDIR" ; then
  125.         echo "Warning:  couldn't find any X11 include files."
  126.         XINCDIR="default"
  127.     fi ])
  128. fi
  129. if test "$XINCDIR" = "/usr/include" ; then
  130.     XINCDIR="default"
  131. fi
  132.  
  133. XLIBDIR="$x_libraries"
  134. if test -z "$XLIBDIR" ; then
  135.     AC_HAVE_LIBRARY(X11, [ XLIBDIR="default" ], [
  136.     places="/usr/X11/lib \
  137.         /usr/X386/lib \
  138.         /usr/X11R5/lib \
  139.         /usr/local/X11R5/lib \
  140.         /usr/lib/X11R5 \
  141.         /usr/openwin/lib \
  142.         /usr/local/X11R4/lib \
  143.         /usr/lib/X11R4 \ 
  144.         /usr/local/lib \
  145.         /usr/unsupported/lib \
  146.         /usr/lib \
  147.         /lib"
  148.     for dir in $places; do
  149.         if test -r $dir/libX11.a; then
  150.             XLIBDIR=$dir
  151.             break
  152.         fi
  153.     done
  154.     if test -z "$XLIBDIR" ; then
  155.     echo "Warning:  couldn't find the X11 library archive. "
  156.     XLIBDIR="default"
  157.     fi ])
  158. fi
  159. if test "$XLIBDIR" = "/usr/lib" ; then
  160.     XLIBDIR="default"
  161. fi
  162.  
  163. XINCSW=""
  164. if test "$XINCDIR" != "default" ; then
  165.     XINCSW="-I$XINCDIR"
  166. fi
  167. AC_SUBST(XINCSW)
  168. XLIBSW=""
  169. if test "$XLIBDIR" != "default" ; then
  170.     XLIBSW="-L$XLIBDIR"
  171. fi
  172. AC_SUBST(XLIBSW)
  173. AC_SUBST(XLIBDIR)
  174.  
  175. # -----------------------------------------------------------------------
  176. #
  177. #     Make some guesses where the Tcl/Tk include files and 
  178. #    libraries are.  I'm not crazy about doing it this way.  
  179. #    It might be better to specify some command-line options
  180. #    when invoking configure.
  181. #
  182. #     Look first in the Tcl/Tk distributions and then move on 
  183. #    to the standard include file/library locations.  If it's 
  184. #    still not found then query for it.
  185. #
  186. # -----------------------------------------------------------------------
  187.  
  188. # -----------------------------------------------------------------------
  189. #    tcl.h
  190. # -----------------------------------------------------------------------
  191. echo "checking for tcl.h"
  192. TCLINCDIR=""
  193. places="$PWD/../tcl7.5a2/generic \
  194.     $PWD/../tcl7.4/ \
  195.     $prefix/include \
  196.     $XINCDIR/tk \
  197.     $XINCDIR \
  198.     /usr/local/include \
  199.     /usr/include"
  200. for dir in $places; do
  201.     if test -r $dir/tcl.h ; then
  202.         TCLINCDIR=$dir
  203.         break
  204.     fi
  205. done
  206. while test -z "$TCLINCDIR" ; do
  207.     echo "What directory contains tcl.h (absolute path, version 7.4+) ?"
  208.     read TCLINCDIR
  209. done
  210. if test "$TCLINCDIR" = "/usr/include" ; then
  211.     TCLINCDIR= "default"
  212. fi
  213.  
  214. TCLINCSW=""
  215. if test "$TCLINCDIR" != "default" ; then
  216.     TCLINCSW="-I$TCLINCDIR"
  217. fi
  218. AC_SUBST(TCLINCSW)
  219.  
  220. # -----------------------------------------------------------------------
  221. #    libtcl.a
  222. # -----------------------------------------------------------------------
  223. echo "checking for libtcl.a"
  224. TCLLIBDIR=""
  225. places="$PWD/../tcl7.5a2/unix \
  226.     $PWD/../tcl7.4/ \
  227.     $prefix/lib \
  228.     $XLIBDIR \
  229.     /usr/local/lib \
  230.     /usr/lib"
  231. for dir in $places; do
  232.     if test -r $dir/libtcl.a ; then
  233.         TCLLIBDIR=$dir
  234.         break
  235.     fi
  236. done
  237. while test -z "$TCLLIBDIR" ; do
  238.     echo "What directory contains libtcl.a (version 7.4+)?"
  239.     read TCLLIBDIR
  240. done
  241. if test "$TCLLIBDIR" = "/usr/lib" ; then
  242.     TCLLIBDIR= "default"
  243. fi
  244.  
  245. TCLLIBSW=""
  246. if test "$TCLLIBDIR" != "default" ; then
  247.     TCLLIBSW="-L$TCLLIBDIR"
  248. fi
  249. AC_SUBST(TCLLIBSW)
  250. AC_SUBST(TCLLIBDIR)
  251.  
  252. # -----------------------------------------------------------------------
  253. #     tk.h
  254. # -----------------------------------------------------------------------
  255. echo "checking for tk.h"
  256. TKINCDIR=""
  257. places="$PWD/../tk4.1a2/generic \
  258.     $PWD/../tk4.0/ \
  259.     $XINCDIR/tk \
  260.     $XINCDIR \
  261.     $prefix/include \
  262.     /usr/local/include \
  263.     /usr/include"
  264. for dir in $places; do
  265.     if test -r $dir/tk.h ; then
  266.         TKINCDIR=$dir
  267.         break
  268.     fi
  269. done
  270. while test -z "$TKINCDIR" ; do
  271.     echo "What directory contains tk.h (absolute path, version 4.0+) ?"
  272.     read TKINCDIR
  273. done
  274. if test "$TKINCDIR" = "/usr/include" ; then
  275.     TKINCDIR="default"
  276. fi
  277.  
  278. TKINCSW=""
  279. if test "$TKINCDIR" != "default" ; then
  280.     TKINCSW="-I$TKINCDIR"
  281. fi
  282. AC_SUBST(TKINCSW)
  283.  
  284. # -----------------------------------------------------------------------
  285. #     libtk.a
  286. # -----------------------------------------------------------------------
  287. echo "checking for libtk.a"
  288. TKLIBDIR=""
  289. places="$PWD/../tk4.1a2/unix \
  290.     $PWD/../tk4.0/ \
  291.     $prefix/lib \
  292.     $XLIBDIR \
  293.     /usr/local/lib \
  294.     /usr/lib"
  295. for dir in $places; do
  296.     if test -r $dir/libtk.a ; then
  297.         TKLIBDIR=$dir
  298.         break
  299.     fi
  300. done
  301. while test -z "$TKLIBDIR" ; do
  302.     echo "What directory contains libtk.a (version 4.0+) ?"
  303.     read TKLIBDIR
  304. done
  305. if test "$TKLIBDIR" = "/usr/lib" ; then
  306.     TKLIBDIR="default"
  307. fi
  308.  
  309. TKLIBSW=""
  310. if test "$TKLIBDIR" != "default" ; then
  311.     TKLIBSW="-L$TKLIBDIR"
  312. fi
  313. AC_SUBST(TKLIBSW)
  314. AC_SUBST(TKLIBDIR) 
  315.  
  316.  
  317. #--------------------------------------------------------------------
  318. #    Check for the existence of various libraries.  The order here
  319. #    is important, so that then end up in the right order in the
  320. #    command line generated by Make.
  321. #--------------------------------------------------------------------
  322. AC_HAVE_LIBRARY(Xbsd, [LIBS="$LIBS -lXbsd"])
  323. AC_HAVE_LIBRARY(socket, [LIBS="$LIBS -lsocket"])
  324. AC_HAVE_LIBRARY(nsl, [LIBS="$LIBS -lnsl"])
  325. # -----------------------------------------------------------------------
  326. #     The library libieee.a is a Linux deal. I don't know what effect 
  327. #    it will have.
  328. # -----------------------------------------------------------------------
  329. AC_HAVE_LIBRARY(-lieee, [LIBS="$LIBS -lieee"])
  330. AC_HAVE_LIBRARY(-lm, [LIBS="$LIBS -lm"])
  331. AC_HAVE_LIBRARY(-ldl, [LIBS="$LIBS -ldl"])
  332. AC_SUBST(LIBS)
  333.  
  334. #--------------------------------------------------------------------
  335. #    Set flags to generate shared libraries for systems that we 
  336. #    know about.
  337. #--------------------------------------------------------------------
  338. echo "checking how to make shared libraries"
  339. SHLIB_CCFLAGS=""
  340. SHLIB_LDFLAGS=""
  341. SHLIB_LOADER=""
  342. SHLIB_SUFFIX=""
  343. AC_PROGRAM_CHECK(uname_found, uname, 1, 0)
  344. [ if test $uname_found -eq 1 ; then
  345.     system=`uname -s`-`uname -r`
  346.     case $system in 
  347.       SunOS-4*) 
  348.         SHLIB_CCFLAGS="-pic"
  349.         SHLIB_LDFLAGS="-assert pure-text"
  350.         SHLIB_LOADER="ld"
  351.         SHLIB_SUFFIX='.so.$(MAJOR_VERSION).$(MINOR_VERSION)'
  352.         ;;
  353.       HP-UX-*.09.*)
  354.         SHLIB_CCFLAGS="+z"
  355.         SHLIB_LDFLAGS="-b -n"
  356.         SHLIB_LOADER="ld"
  357.         SHLIB_SUFFIX=".sl"
  358.         ;;
  359.       HP-UX-*.10.*)
  360.         SHLIB_CCFLAGS="+z"
  361.         SHLIB_LDFLAGS="-b -n"
  362.         SHLIB_LOADER="ld"
  363.         SHLIB_SUFFIX=".sl"
  364.         ;;
  365.       SunOS-5*)
  366.         SHLIB_CCFLAGS="-K pic"
  367.         SHLIB_LDFLAGS='-G -ztext -h $(SHARED_LIBRARY)'
  368.         SHLIB_LOADER="$CC"
  369.         SHLIB_SUFFIX='.so.$(MAJOR_VERSION)'
  370.         ;;
  371.       OSF-1.*)
  372.         SHLIB_CCFLAGS="-fpic"
  373.         SHLIB_LDFLAGS="-shared"
  374.         SHLIB_LOADER="$CC"
  375.         SHLIB_SUFFIX='.so.$(MAJOR_VERSION)'
  376.     ;;
  377.       IRIX-5.*)
  378.         SHLIB_CCFLAGS="-KPIC"
  379.         SHLIB_LDFLAGS="-shared"
  380.         SHLIB_LOADER="$CC"
  381.         SHLIB_SUFFIX='.so.$(MAJOR_VERSION)'
  382.         ;;
  383.       *)
  384.     echo "Don't know how to make shared libraries for $system"
  385.     ;;
  386.     esac
  387.     if test ! -z "SHLIB_CCFLAGS" ; then 
  388.         if test "$compiler" = "gcc" ; then
  389.             SHLIB_CCFLAGS="-fpic"
  390.         fi
  391.     fi
  392. fi ]
  393.  
  394. AC_SUBST(SHLIB_CCFLAGS)
  395. AC_SUBST(SHLIB_LDFLAGS)
  396. AC_SUBST(SHLIB_LOADER)
  397. AC_SUBST(SHLIB_SUFFIX)
  398.  
  399. #--------------------------------------------------------------------
  400. #    Propagate prefix argument as installation directory.
  401. #--------------------------------------------------------------------
  402. DESTDIR="$prefix"
  403. BINDIR="$DESTDIR/bin"
  404. LIBDIR="$DESTDIR/lib"
  405. MANDIR="$DESTDIR/man"
  406. BLT_LIBRARY="$DESTDIR/lib/blt"
  407.  
  408. AC_SUBST(DESTDIR)
  409. AC_SUBST(BINDIR)
  410. AC_SUBST(LIBDIR)
  411. AC_SUBST(MANDIR)
  412. AC_SUBST(BLT_LIBRARY)
  413.  
  414. #--------------------------------------------------------------------
  415. #
  416. #    Generate the following Makefiles
  417. #
  418. #       ./Makefile
  419. #       ./src/Makefile
  420. #       ./src/shared/Makefile
  421. #       ./man/Makefile
  422. #       ./library/Makefile
  423. #
  424. #--------------------------------------------------------------------
  425. AC_OUTPUT(Makefile src/Makefile src/shared/Makefile man/Makefile library/Makefile)
  426.  
  427. #--------------------------------------------------------------------
  428. #    Print out some of the more important settings 
  429. #--------------------------------------------------------------------
  430. echo "
  431. Configuration results (edit and run ./config.status to modify):
  432.  
  433. directory containing \"tcl.h\"      => $TCLINCDIR
  434. directory containing \"tk.h\"       => $TKINCDIR
  435. directory containing \"X11/Xlib.h\" => $XINCDIR
  436. directory containing \"libtcl.a\"   => $TCLLIBDIR
  437. directory containing \"libtk.a\"    => $TKLIBDIR
  438. directory containing \"libX11.a\"   => $XLIBDIR
  439. directory to install \"blt_wish\"   => $BINDIR
  440. directory to install \"libBLT.a\"   => $LIBDIR
  441. directory to install BLT library files => $BLT_LIBRARY
  442. "
  443.